/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('rds-data', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model BatchExecuteStatementResult {
  generatedFieldsList?: [[
    Field
  ]  ](name='GeneratedFieldsList'),
}

model BeginTransactionResult {
  transactionId?: string(name='TransactionId'),
}

model ColumnMetadata {
  arrayBaseColumnType?: int32(name='ArrayBaseColumnType'),
  isAutoIncrement?: boolean(name='IsAutoIncrement'),
  isCaseSensitive?: boolean(name='IsCaseSensitive'),
  isCurrency?: boolean(name='IsCurrency'),
  isSigned?: boolean(name='IsSigned'),
  label?: string(name='Label'),
  name?: string(name='Name'),
  nullable?: int32(name='Nullable'),
  precision?: int32(name='Precision'),
  scale?: int32(name='Scale'),
  schemaName?: string(name='SchemaName'),
  tableName?: string(name='TableName'),
  type?: int32(name='Type'),
  typeName?: string(name='TypeName'),
}

model CommitTransactionResult {
  transactionStatus?: string(name='TransactionStatus'),
}

model DeleteResult {
  numberOfRecordsUpdated?: long(name='NumberOfRecordsUpdated'),
}

model ExecuteStatementResult {
  columnMetadata?: [
    ColumnMetadata
  ](name='ColumnMetadata'),
  formattedRecords?: string(name='FormattedRecords'),
  generatedFields?: [
    Field
  ](name='GeneratedFields'),
  numberOfRecordsUpdated?: long(name='NumberOfRecordsUpdated'),
  records?: [[
    Field
  ]  ](name='Records'),
}

model Field {
  arrayValue?: string(name='ArrayValue'),
  blobValue?: string(name='BlobValue'),
  booleanValue?: boolean(name='BooleanValue'),
  isNull?: boolean(name='IsNull'),
  longValue?: long(name='LongValue'),
  stringValue?: string(name='StringValue'),
}

model InsertListResult {
  autoIncrementKeys?: [ long ](name='AutoIncrementKeys'),
  numberOfRecordsUpdated?: long(name='NumberOfRecordsUpdated'),
}

model InsertResult {
  autoIncrementKey?: long(name='AutoIncrementKey'),
  numberOfRecordsUpdated?: long(name='NumberOfRecordsUpdated'),
}

model ResultSetOptions {
  decimalReturnType?: string(name='DecimalReturnType'),
  longReturnType?: string(name='LongReturnType'),
}

model RollbackTransactionResult {
  transactionStatus?: string(name='TransactionStatus'),
}

model SelectResult {
  records?: [ map[string]any ](name='Records'),
}

model Selector {
  eq?: string(name='Eq'),
  ge?: string(name='Ge'),
  gt?: string(name='Gt'),
  le?: string(name='Le'),
  like?: string(name='Like'),
  lt?: string(name='Lt'),
  ne?: string(name='Ne'),
}

model SqlParameter {
  name?: string(name='Name'),
  typeHint?: string(name='TypeHint'),
  value?: Field(name='Value'),
}

model UpdateResult {
  numberOfRecordsUpdated?: long(name='NumberOfRecordsUpdated'),
}

model BatchExecuteStatementRequest {
  database?: string(name='Database', example='test'),
  parameterSets?: [[
    SqlParameter
  ]  ](name='ParameterSets'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  sql?: string(name='Sql', example='insert into users(name) values(:name)'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model BatchExecuteStatementShrinkRequest {
  database?: string(name='Database', example='test'),
  parameterSetsShrink?: string(name='ParameterSets'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  sql?: string(name='Sql', example='insert into users(name) values(:name)'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model BatchExecuteStatementResponseBody = {
  code?: string(name='Code', example='200'),
  data?: BatchExecuteStatementResult(name='Data'),
  message?: string(name='Message', example='There is an error in the call.'),
  requestId?: string(name='RequestId', example='CDAEE474-87E5-5AE3-A534-922F90D5867D'),
  success?: boolean(name='Success', example='true'),
}

model BatchExecuteStatementResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: BatchExecuteStatementResponseBody(name='body'),
}

async function batchExecuteStatementWithOptions(tmpReq: BatchExecuteStatementRequest, runtime: Util.RuntimeOptions): BatchExecuteStatementResponse {
  Util.validateModel(tmpReq);
  var request = new BatchExecuteStatementShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.parameterSets)) {
    request.parameterSetsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.parameterSets, 'ParameterSets', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.database)) {
    body['Database'] = request.database;
  }
  if (!Util.isUnset(request.parameterSetsShrink)) {
    body['ParameterSets'] = request.parameterSetsShrink;
  }
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.sql)) {
    body['Sql'] = request.sql;
  }
  if (!Util.isUnset(request.transactionId)) {
    body['TransactionId'] = request.transactionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'BatchExecuteStatement',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function batchExecuteStatement(request: BatchExecuteStatementRequest): BatchExecuteStatementResponse {
  var runtime = new Util.RuntimeOptions{};
  return batchExecuteStatementWithOptions(request, runtime);
}

model BeginTransactionRequest {
  database?: string(name='Database', example='test'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds:cn-hangzhou:1335786916******:rds-db-credent****/zha***Test03-21****'),
}

model BeginTransactionResponseBody = {
  code?: string(name='Code', example='200'),
  data?: BeginTransactionResult(name='Data'),
  message?: string(name='Message', example='There is an error in the call.'),
  requestId?: string(name='RequestId', example='4FD736C2-D774-5ACF-8366-8A72114BE7F9'),
  success?: boolean(name='Success', example='true'),
}

model BeginTransactionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: BeginTransactionResponseBody(name='body'),
}

async function beginTransactionWithOptions(request: BeginTransactionRequest, runtime: Util.RuntimeOptions): BeginTransactionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.database)) {
    body['Database'] = request.database;
  }
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'BeginTransaction',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function beginTransaction(request: BeginTransactionRequest): BeginTransactionResponse {
  var runtime = new Util.RuntimeOptions{};
  return beginTransactionWithOptions(request, runtime);
}

model CommitTransactionRequest {
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model CommitTransactionResponseBody = {
  code?: string(name='Code', example='200'),
  data?: CommitTransactionResult(name='Data'),
  message?: string(name='Message', example='There is an error in the call.'),
  requestId?: string(name='RequestId', example='9689CF67-B653-5A0F-B9E3-3CC6BBD580ED'),
  success?: boolean(name='Success', example='true'),
}

model CommitTransactionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CommitTransactionResponseBody(name='body'),
}

async function commitTransactionWithOptions(request: CommitTransactionRequest, runtime: Util.RuntimeOptions): CommitTransactionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.transactionId)) {
    body['TransactionId'] = request.transactionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CommitTransaction',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function commitTransaction(request: CommitTransactionRequest): CommitTransactionResponse {
  var runtime = new Util.RuntimeOptions{};
  return commitTransactionWithOptions(request, runtime);
}

model DeleteRequest {
  database?: string(name='Database', example='photoview'),
  filter?: map[string]Selector(name='Filter'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds:cn-hangzhou:1335786916******:rds-db-credent****/zha***Test03-21****'),
  table?: string(name='Table', example='users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model DeleteShrinkRequest {
  database?: string(name='Database', example='photoview'),
  filterShrink?: string(name='Filter'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds:cn-hangzhou:1335786916******:rds-db-credent****/zha***Test03-21****'),
  table?: string(name='Table', example='users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model DeleteResponseBody = {
  code?: string(name='Code', example='200'),
  data?: DeleteResult(name='Data'),
  message?: string(name='Message', example='There is an error in the call.'),
  requestId?: string(name='RequestId', example='4FD736C2-D774-5ACF-8366-8A72114BE7F9'),
  success?: boolean(name='Success', example='true'),
}

model DeleteResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteResponseBody(name='body'),
}

async function deleteWithOptions(tmpReq: DeleteRequest, runtime: Util.RuntimeOptions): DeleteResponse {
  Util.validateModel(tmpReq);
  var request = new DeleteShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'Filter', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.database)) {
    body['Database'] = request.database;
  }
  if (!Util.isUnset(request.filterShrink)) {
    body['Filter'] = request.filterShrink;
  }
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.table)) {
    body['Table'] = request.table;
  }
  if (!Util.isUnset(request.transactionId)) {
    body['TransactionId'] = request.transactionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'Delete',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function delete(request: DeleteRequest): DeleteResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteWithOptions(request, runtime);
}

model ExecuteStatementRequest {
  continueAfterTimeout?: boolean(name='ContinueAfterTimeout', example='true'),
  database?: string(name='Database', example='test'),
  formatRecordsAs?: string(name='FormatRecordsAs', example='JSON'),
  includeResultMetadata?: boolean(name='IncludeResultMetadata', example='true'),
  parameters?: [
    SqlParameter
  ](name='Parameters'),
  resourceArn?: string(name='ResourceArn'),
  resultSetOptions?: {
    decimalReturnType?: string(name='DecimalReturnType', example='STRING'),
    longReturnType?: string(name='LongReturnType', example='STRING'),
  }(name='ResultSetOptions'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  sql?: string(name='Sql', example='select * from users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model ExecuteStatementShrinkRequest {
  continueAfterTimeout?: boolean(name='ContinueAfterTimeout', example='true'),
  database?: string(name='Database', example='test'),
  formatRecordsAs?: string(name='FormatRecordsAs', example='JSON'),
  includeResultMetadata?: boolean(name='IncludeResultMetadata', example='true'),
  parametersShrink?: string(name='Parameters'),
  resourceArn?: string(name='ResourceArn'),
  resultSetOptionsShrink?: string(name='ResultSetOptions'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  sql?: string(name='Sql', example='select * from users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model ExecuteStatementResponseBody = {
  code?: string(name='Code', example='200'),
  data?: ExecuteStatementResult(name='Data'),
  message?: string(name='Message', example='There is an error in the call.'),
  requestId?: string(name='RequestId', example='CDAEE474-87E5-5AE3-A534-922F90D5867D'),
  success?: boolean(name='Success', example='true'),
}

model ExecuteStatementResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ExecuteStatementResponseBody(name='body'),
}

async function executeStatementWithOptions(tmpReq: ExecuteStatementRequest, runtime: Util.RuntimeOptions): ExecuteStatementResponse {
  Util.validateModel(tmpReq);
  var request = new ExecuteStatementShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.parameters)) {
    request.parametersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.parameters, 'Parameters', 'json');
  }
  if (!Util.isUnset(tmpReq.resultSetOptions)) {
    request.resultSetOptionsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resultSetOptions, 'ResultSetOptions', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.continueAfterTimeout)) {
    body['ContinueAfterTimeout'] = request.continueAfterTimeout;
  }
  if (!Util.isUnset(request.database)) {
    body['Database'] = request.database;
  }
  if (!Util.isUnset(request.formatRecordsAs)) {
    body['FormatRecordsAs'] = request.formatRecordsAs;
  }
  if (!Util.isUnset(request.includeResultMetadata)) {
    body['IncludeResultMetadata'] = request.includeResultMetadata;
  }
  if (!Util.isUnset(request.parametersShrink)) {
    body['Parameters'] = request.parametersShrink;
  }
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.resultSetOptionsShrink)) {
    body['ResultSetOptions'] = request.resultSetOptionsShrink;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.sql)) {
    body['Sql'] = request.sql;
  }
  if (!Util.isUnset(request.transactionId)) {
    body['TransactionId'] = request.transactionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ExecuteStatement',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function executeStatement(request: ExecuteStatementRequest): ExecuteStatementResponse {
  var runtime = new Util.RuntimeOptions{};
  return executeStatementWithOptions(request, runtime);
}

model InsertRequest {
  database?: string(name='Database', example='photoview'),
  record?: map[string]any(name='Record'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  table?: string(name='Table', example='users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model InsertShrinkRequest {
  database?: string(name='Database', example='photoview'),
  recordShrink?: string(name='Record'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  table?: string(name='Table', example='users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model InsertResponseBody = {
  code?: string(name='Code', example='200'),
  data?: InsertResult(name='Data'),
  message?: string(name='Message', example='There is an error in the call'),
  requestId?: string(name='RequestId', example='9689CF67-B653-5A0F-B9E3-3CC6BBD580ED'),
  success?: boolean(name='Success', example='true'),
}

model InsertResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: InsertResponseBody(name='body'),
}

async function insertWithOptions(tmpReq: InsertRequest, runtime: Util.RuntimeOptions): InsertResponse {
  Util.validateModel(tmpReq);
  var request = new InsertShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.record)) {
    request.recordShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.record, 'Record', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.database)) {
    body['Database'] = request.database;
  }
  if (!Util.isUnset(request.recordShrink)) {
    body['Record'] = request.recordShrink;
  }
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.table)) {
    body['Table'] = request.table;
  }
  if (!Util.isUnset(request.transactionId)) {
    body['TransactionId'] = request.transactionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'Insert',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function insert(request: InsertRequest): InsertResponse {
  var runtime = new Util.RuntimeOptions{};
  return insertWithOptions(request, runtime);
}

model InsertListRequest {
  database?: string(name='Database', example='test_db'),
  records?: [ map[string]any ](name='Records'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credenti***/mySecret-Uy****'),
  table?: string(name='Table', example='user'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model InsertListShrinkRequest {
  database?: string(name='Database', example='test_db'),
  recordsShrink?: string(name='Records'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credenti***/mySecret-Uy****'),
  table?: string(name='Table', example='user'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model InsertListResponseBody = {
  code?: string(name='Code', example='200'),
  data?: InsertListResult(name='Data'),
  message?: string(name='Message', example='There is an error in the call.'),
  requestId?: string(name='RequestId', example='D2FEE6D7-DCA6-57B4-946A-9E670B773518'),
  success?: boolean(name='Success', example='true'),
}

model InsertListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: InsertListResponseBody(name='body'),
}

async function insertListWithOptions(tmpReq: InsertListRequest, runtime: Util.RuntimeOptions): InsertListResponse {
  Util.validateModel(tmpReq);
  var request = new InsertListShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.records)) {
    request.recordsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.records, 'Records', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.database)) {
    body['Database'] = request.database;
  }
  if (!Util.isUnset(request.recordsShrink)) {
    body['Records'] = request.recordsShrink;
  }
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.table)) {
    body['Table'] = request.table;
  }
  if (!Util.isUnset(request.transactionId)) {
    body['TransactionId'] = request.transactionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'InsertList',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function insertList(request: InsertListRequest): InsertListResponse {
  var runtime = new Util.RuntimeOptions{};
  return insertListWithOptions(request, runtime);
}

model RollbackTransactionRequest {
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credenti***/mySecret-Uy****'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model RollbackTransactionResponseBody = {
  code?: string(name='Code', example='200'),
  data?: RollbackTransactionResult(name='Data'),
  message?: string(name='Message', example='There is an error in the call.'),
  requestId?: string(name='RequestId', example='D2FEE6D7-DCA6-57B4-946A-9E670B773518'),
  success?: boolean(name='Success', example='true'),
}

model RollbackTransactionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RollbackTransactionResponseBody(name='body'),
}

async function rollbackTransactionWithOptions(request: RollbackTransactionRequest, runtime: Util.RuntimeOptions): RollbackTransactionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.transactionId)) {
    body['TransactionId'] = request.transactionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RollbackTransaction',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function rollbackTransaction(request: RollbackTransactionRequest): RollbackTransactionResponse {
  var runtime = new Util.RuntimeOptions{};
  return rollbackTransactionWithOptions(request, runtime);
}

model SelectRequest {
  database?: string(name='Database', example='photoview'),
  filter?: map[string]Selector(name='Filter'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  table?: string(name='Table', example='users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model SelectShrinkRequest {
  database?: string(name='Database', example='photoview'),
  filterShrink?: string(name='Filter'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  resourceArn?: string(name='ResourceArn'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  table?: string(name='Table', example='users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model SelectResponseBody = {
  code?: string(name='Code', example='200'),
  data?: SelectResult(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='CDAEE474-87E5-5AE3-A534-922F90D5867D'),
  success?: boolean(name='Success', example='true'),
}

model SelectResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SelectResponseBody(name='body'),
}

async function selectWithOptions(tmpReq: SelectRequest, runtime: Util.RuntimeOptions): SelectResponse {
  Util.validateModel(tmpReq);
  var request = new SelectShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'Filter', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.database)) {
    body['Database'] = request.database;
  }
  if (!Util.isUnset(request.filterShrink)) {
    body['Filter'] = request.filterShrink;
  }
  if (!Util.isUnset(request.pageNumber)) {
    body['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.table)) {
    body['Table'] = request.table;
  }
  if (!Util.isUnset(request.transactionId)) {
    body['TransactionId'] = request.transactionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'Select',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function select(request: SelectRequest): SelectResponse {
  var runtime = new Util.RuntimeOptions{};
  return selectWithOptions(request, runtime);
}

model UpdateRequest {
  database?: string(name='Database', example='photoview'),
  filter?: map[string]Selector(name='Filter'),
  record?: map[string]any(name='Record'),
  resourceArn?: string(name='ResourceArn', example='acs:rds:cn-hangzhou:1484143351265396:dbinstance/rm-bp1b8h01q6t19p8s6'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  table?: string(name='Table', example='users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model UpdateShrinkRequest {
  database?: string(name='Database', example='photoview'),
  filterShrink?: string(name='Filter'),
  recordShrink?: string(name='Record'),
  resourceArn?: string(name='ResourceArn', example='acs:rds:cn-hangzhou:1484143351265396:dbinstance/rm-bp1b8h01q6t19p8s6'),
  secretArn?: string(name='SecretArn', example='acs:rds-api:cn-hangzhou:1266348003******:rds-db-credentials/mySecret-Uy****'),
  table?: string(name='Table', example='users'),
  transactionId?: string(name='TransactionId', example='8609****-94e1-45ce-8e25-354e3dd8****'),
}

model UpdateResponseBody = {
  code?: string(name='Code', example='200'),
  data?: UpdateResult(name='Data'),
  message?: string(name='Message', example='There is an error in the call.'),
  requestId?: string(name='RequestId', example='9689CF67-B653-5A0F-B9E3-3CC6BBD580ED'),
  success?: boolean(name='Success', example='true'),
}

model UpdateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateResponseBody(name='body'),
}

async function updateWithOptions(tmpReq: UpdateRequest, runtime: Util.RuntimeOptions): UpdateResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'Filter', 'json');
  }
  if (!Util.isUnset(tmpReq.record)) {
    request.recordShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.record, 'Record', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.database)) {
    body['Database'] = request.database;
  }
  if (!Util.isUnset(request.filterShrink)) {
    body['Filter'] = request.filterShrink;
  }
  if (!Util.isUnset(request.recordShrink)) {
    body['Record'] = request.recordShrink;
  }
  if (!Util.isUnset(request.resourceArn)) {
    body['ResourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.secretArn)) {
    body['SecretArn'] = request.secretArn;
  }
  if (!Util.isUnset(request.table)) {
    body['Table'] = request.table;
  }
  if (!Util.isUnset(request.transactionId)) {
    body['TransactionId'] = request.transactionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'Update',
    version = '2022-03-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function update(request: UpdateRequest): UpdateResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateWithOptions(request, runtime);
}

